﻿@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'table', 'commonTable', 'common', 'optimizeSelectOption'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table, commonTable = layui.commonTable,
            common = layui.common;
        var keyValue = $.request("keyValue");
        commonTable.rendertable({
            elem: '#currentTableId',
            id: 'currentTableId',
            search: false,
            limit: 9999,//每页数据 默认
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['count'] //自定义分页布局
                , first: false //不显示首页
                , last: false //不显示尾页
            },
            defaultToolbar: [],
            toolbar: '',//工具栏
            data: [],
            height: 'full-140',
            cols: [[
                { field: 'F_CreatorTime', title: '历史时间', minWidth: 170, sort: true },
                {
                    field: 'F_PrintTemplatePath', title: '下载地址', minWidth: 150
                },
                { title: '操作', width: 105, toolbar: '#currentTableBar', align: "center" }
            ]]
        });
        //toolrow监听事件
        table.on('tool(currentTableFilter)', function (obj) {
            var id = obj.data.F_Id;
            if (obj.event === 'download') {
                window.open('/SystemManage/PrintTemplate/Download?filePath=' + obj.data.F_PrintTemplatePath);
            }
            return false;
        });
        $(function () {
            common.ajax({
                url: '/SystemManage/ReportTemplate/GetFormJson',
                dataType: 'json',
                data: { keyValue: keyValue },
                async: false,
                success: function (data) {
                    common.val('adminform', data);
                    common.setReadOnly('adminform');
                    if (!!data.list && data.list.length > 0) {
                        table.reload('currentTableId', {
                            data: data.list
                        });
                    }
                    form.render();
                }
            });
        });
        wcLoading.close();
    });
</script>

<body>
    <script type="text/html" id="currentTableBar">
        <a id="NF-download" class="layui-btn layui-btn-sm" lay-event="download"><i class="layui-icon">&#xe601;</i></a>
    </script>
    <div class="layuimini-container" lay-filter="adminform">
        <div class="layuimini-main">
            <form class="layui-form layuimini-form">
                <div class="layui-form-item">
                    <div class="layui-col-md6 layui-col-sm6">
                        <label class="layui-form-label">模板名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="F_PrintTemplateName" name="F_PrintTemplateName" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6 layui-col-sm6">
                        <label class="layui-form-label">模板地址</label>
                        <div class="layui-input-block">
                            <input type="text" id="F_PrintTemplatePath" name="F_PrintTemplatePath" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">历史列表</label>
                        <div class="layui-input-block">
                            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>

